//
//  ShlRecordManager.h
//  CommonAppSHL
//
//  Created by mac on 2021/6/7.
//

#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>

#import "MLAudioRecorder.h"
#import "CafRecordWriter.h"
#import "AmrRecordWriter.h"
#import "Mp3RecordWriter.h"
#import "MLAudioMeterObserver.h"


NS_ASSUME_NONNULL_BEGIN

@interface ShlRecordManager : NSObject
// 录音
@property (nonatomic, strong) MLAudioRecorder *recorder;
// caf格式录音写入
@property (nonatomic, strong) CafRecordWriter *cafWriter;
// amr格式录音写入
@property (nonatomic, strong) AmrRecordWriter *amrWriter;
// mp3格式录音写入
@property (nonatomic, strong) Mp3RecordWriter *mp3Writer;
// 监听
@property (nonatomic, strong) MLAudioMeterObserver *meterObserver;
// 播放器
@property (retain, nonatomic) AVAudioPlayer *audioPlayer;
// type 0:caf 1:amr 2:mp3
@property (assign, nonatomic) NSInteger record_type;

// 单例
+ (instancetype)manager;
// 请求麦克风权限
- (BOOL)RequestPermission;
// 初始化录音格式类型
- (void)initFilePathWithType:(NSInteger)record_type;
// 开始录制
- (void)startRecord;
// 结束录制
- (void)stopRecord;
// mp3结束录制，返回base64的字符串
- (NSString *)stopMp3Record;
// 播放录制语音
- (void)playRecord;
// 移出所有path的文件
- (void)deleteAllFile;

@end

NS_ASSUME_NONNULL_END
